package com.example.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.xiaoyudeguang.annotation.JsonField;
import com.xiaoyudeguang.handler.ObjectNodeTypeHandler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 * @author 赵光
 */
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_user")
public class SysUser {

    @Id
    @TableId(type = IdType.AUTO)
    private Long id;

    @JsonField
    private String userNo;

    @JsonField
    private String userName;

    @TableField(typeHandler = ObjectNodeTypeHandler.class)
    @Column(nullable = false, columnDefinition = "json comment '扩展字段'")
    private ObjectNode json;
}
